# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
从数据库查相应数据，加到dist数据中
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

import pymysql
from baseset.msydloanApi import API_MSYD

db = pymysql.connect(
        host="rm-wz905n9ed226krle9.mysql.rds.aliyuncs.com",    # 生产环境
        user="rds2zenglingwei",             # 测试：dev   开发：root
        password="oKa#sPoj",       # 测试：dev   开发：123456
        port=3306,
        use_unicode=True,
        charset="utf8",
        database="msydloandb")           # qdzjmsloandb  ， bxloandb  msydloandb, msreport
cursor = db.cursor()

# 中移动项目：对账文件
def get_payInfo(acp_date):
    sql = 'select mpl_ord_no,acp_dt from hb_loanfile_detail where substr(acp_dt,1,10)="%s" and mpl_ord_no ' \
          'not in (select brw_ord_no from pkg_notice) and mpl_ord_no in (select ext_serial_number from pro_main where status="P") ; '%(acp_date)
    cursor.execute(sql)
    results = cursor.fetchall()
    info = []
    for result in results:
        row = []
        for data in result:
            try:
                data = data.strftime('%Y%m%d%H%M')[0:8]
            except:
                data =str(data)
            row.append(data)
        info.append(row)
    #print(info)
    return(info)


def add_dict():
    org_list = API_MSYD['spareHandling']['handlingList']
    org_list = ''
    print(type(org_list))


if __name__ == '__main__':
    #get_payInfo('2019-09-29')
    add_dict()